package com.greenline.push.dal.pushcenter.impl;

import java.util.List;

import com.greenline.push.dal.base.BaseDAO;
import com.greenline.push.dal.pushcenter.DomainDAO;
import com.greenline.push.dal.pushcenter.dataobject.DomainDO;
import com.greenline.push.dal.query.DomainQuery;

public class DomainDAOImpl extends BaseDAO implements DomainDAO {

    @Override
    public Long insert(DomainDO domainDO) {
        return (Long) super.getSqlMapClientTemplate().insert("domain.insert", domainDO);
    }

    @Override
    public DomainDO getById(Long id) {
        return (DomainDO) super.getSqlMapClientTemplate().queryForObject("domain.find_by_id", id);
    }

    @Override
    public Integer update(DomainDO domainDO) {
        return super.getSqlMapClientTemplate().update("domain.update", domainDO);
    }

    @Override
    public Integer delete(Long id) {
        return super.getSqlMapClientTemplate().delete("domain.delete", id);
    }

    @Override
    public DomainQuery listByQuery(DomainQuery query) {
        return (DomainQuery) super.listByQuery("domain.list_by_query", query);
    }

    @SuppressWarnings("unchecked")
    @Override
    public List<DomainDO> listAll() {
        return this.getSqlMapClientTemplate().queryForList("domain.list_all");
    }

    @Override
    public DomainDO getByCode(String code) {
        return (DomainDO) this.getSqlMapClientTemplate().queryForObject("domain.get_by_code", code);
    }

}
